home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / pgm_tool / lu62 / debug / fttlu.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  25KB  |  867 lines

  1. /*
  2.  *  CopyRight 1995. Nicholas Poljakov all rights reserved.
  3.  */
  4. #include <dos.h>
  5. #include <bios.h>
  6. #include <memory.h>
  7. #include <string.h>
  8. #include <stdlib.h>
  9. #include <stdio.h>
  10. #include <conio.h>
  11. #include <direct.h>
  12. #include <io.h>
  13. #include <fcntl.h>        /* O_ constant definitions */
  14. #include <sys\types.h>
  15. #include <sys\stat.h>        /* S_ constant definitions */
  16. #include <state1.h>
  17.  
  18. #define BORDER 1
  19. #define REV_VID 0x70
  20. #define NORM_VID 0x1E
  21. #define MAX_FRAME 31
  22. #define BKSP 8
  23. #define F1 59
  24. #define F2 60
  25. #define F3 61
  26. #define F4 62
  27. #define F5 63
  28. #define F6 64
  29. #define F7 65
  30. #define F8 66
  31. #define F9 67
  32. #define F10 68
  33.  
  34. #define MONO  1             /* Constant values for adapter */
  35. #define CGA   2                         /*   variable */
  36. #define EGA   3
  37.  
  38. #define HM  71     /* Home key      */
  39. #define UP  72   /* Up Arrow     */
  40. #define PU  73   /* Page Up      */
  41. #define LT  75   /* Left Arrow   */
  42. #define RT  77   /* Right Arrow  */
  43. #define END 79   /* End key      */
  44. #define DN  80   /* Down Arrow   */
  45. #define PD  81   /* Page Down    */
  46. #define ESC '\033'
  47. #define DIR 0x10
  48.  
  49. #define ROWS1
  50. #define ROWS2 23
  51. #define ROWS  25
  52. #define COLS 78
  53. #define L_W 20
  54. #define M_W 36
  55. #define R_W 20
  56. #define SCRNSIZE ((ROWS)*(COLS+2)*2)
  57. #define LAST (24 * 80)*2
  58.  
  59. #define M0C  4     /* Files maping col.s */
  60. #define M0L  14    /* Files maping rows  */
  61. #define M0F (((80 * 5) + 9)) * 2
  62. #define INTR 18*2
  63.  
  64. struct APL_PARM{
  65.        int status;  /* 0-start aplmain,1-start transaction,2-dos shell */
  66.        char p[80];  /* string for system(p) */
  67.        char args[64];/* string of arguments */
  68.        int rc;      /* aplmain return code */
  69.        char dir[60];/* directory name for aplmain */
  70.        int drlen;   /* directory name length */
  71.        void *tpe;   /* entry of exit program */
  72.        char pgm_state;
  73. }*p_aparm;
  74. struct LU_PARM{
  75.        unsigned long conv_id;
  76.        unsigned char lu_id[8];
  77.        unsigned char tp_id[8];
  78. }*p_lparm;
  79.  
  80. int  fd_ini = -1;
  81. unsigned char cur_off = 0;
  82. int inv_off;
  83. unsigned int attr1b;
  84. void **ptrs;
  85. int size;
  86. unsigned char row, col;
  87. int adapter;
  88. unsigned char far *videomem;
  89. int offset;
  90. int sw = 0;
  91. char pi[40];
  92. char po[40];
  93. char *pa[2];  /* path in & path out pointers */
  94. char path[18];
  95. char file[12];
  96. char tpname[31];
  97. char lu_name[9];
  98. char ps[4][14];
  99. char lu_id[8] = {0,0,0,0,0,0,0,0};
  100. struct crtp *p_crtp;
  101. char InTp[40];
  102. unsigned long conv_id;
  103. char tp_id[8] = {0,0,0,0,0,0,0,0};
  104. char tp_exist = 0; /* Tp_exist eq. 0 if TP not active, and 1 vice versus.*/
  105. char mode_name[9];
  106. char CurFile[14];
  107. char dta[128];
  108. char far *vid_mem;
  109. short cur_ln = 0;
  110. int p_lu_num = 0;   /* number of LU - partners */
  111. struct    part    {         /* partner structure */
  112.                   char   plu[8] ;             /* str plu_name        */
  113.                   int psl;                    /* str plu_s_limit     */
  114.                   char   mode_name[8] ;       /* str mode_name       */
  115.                   int max_ru_size;            /* str ru_h_size       */
  116.                   int pacing;                 /* str =               */
  117.                   unsigned char lu_type;
  118.                }  pstr[4];
  119. struct menu_frame {
  120.     int startx, endx, starty, endy;
  121.     unsigned char *p;
  122.     char **menu;
  123.     char *keys;
  124.     int border;
  125.     int count;
  126.     unsigned char attrib;
  127.     int active;
  128.     int curx, cury;
  129.     char *header;
  130.     unsigned char shd;
  131.     } frame[MAX_FRAME];
  132.  
  133. char *topline[] = {
  134.     "File",
  135.     "Run",
  136.     "Options",
  137.     "Help"
  138.     };
  139. char *btline[] = {
  140.     "F1 - Help",
  141.     "F3 - View",
  142.     "F5 - Send",
  143.     "F9 - Filter",
  144.     "F10 - Menu",
  145.     "F8 - Command"
  146.     };
  147. char *f_opt[] = {
  148.     "Drive     ",
  149.     "Dos shell ",
  150.     "About     ",
  151.     "Exit      "
  152.     };
  153. char *r_opt[] = {
  154.     "Attach ...",
  155.     "Detach ...",
  156.     "Select ...",
  157.     "Copy   ...",
  158.     "TTY    ..."
  159.     };
  160. char *o_opt[] = {
  161.     "Change LU options",
  162.     "Show partners    ",
  163.     "Remote control   "
  164.     };
  165. char *dr_opt[] = {
  166.     "-- A --",
  167.     "-- B --",
  168.     "-- C --",
  169.     "-- D --",
  170.     "-- E --",
  171.     "-- F --",
  172.     "-- G --"
  173.     };
  174. char *prwin[] = {
  175.     "                            ",
  176.     "  Sample LU 6.2 application ",
  177.     "        program.            ",
  178.     "                            ",
  179.     "     Nicholas Poljakov.     ",
  180.     "         Email:             ",
  181.     "poljakov@vertex.inria.msu.ru"
  182.     };
  183. unsigned char *tlx[5];
  184.  
  185. char far *sv;
  186. char *tpx1 = "╔═════════════════╤════════════╤═════════╗";
  187. char *tpx2 = "║ Partner LU name │ MODE name  │ LU Type ║";
  188. char *tpx3 = "╠═════════════════╪════════════╪═════════╣";
  189. char *tpx4 = "║                 │            │         ║";
  190. char *tpx5 = "╚═════════════════╧════════════╧═════════╝";
  191. char p_dcl[21] = "Current path is : ";
  192. unsigned char dr_ind[80];
  193. char c_pt[60];
  194. int drive_ind[10];
  195. char *window_getche();
  196. int vmode;
  197. #define TPG    50
  198. struct index
  199.     {  long reset;
  200.        char ind_str[4];
  201.        short lentxt;
  202.     } index[TPG];
  203. int fp_help;
  204.  
  205. main(argc, argv)
  206. int argc;
  207. char *argv[];
  208. {
  209.         int i;
  210.        int drivecnt;
  211.        unsigned char j;
  212.        void _near *tp1;
  213.        void _near *tp2;
  214.        char _far *ttp;
  215.  
  216.         union
  217.     {                    /* Access equiment either as:     */
  218.     unsigned u;            /*   unsigned or         */
  219.     struct                /*   bit fields          */
  220.     {
  221.         unsigned diskflag : 1;    /* Diskette drive installed?     */
  222.         unsigned coprocessor : 1;    /* Coprocessor? (except on PC)     */
  223.         unsigned sysram : 2;    /* RAM on system board         */
  224.         unsigned video : 2;     /* Startup video mode         */
  225.         unsigned disks : 2;     /* Drives 00=1, 01=2, 10=3, 11=4 */
  226.         unsigned dma : 1;        /* 0=Yes, 1=No (1 for PC Jr.)     */
  227.         unsigned comports : 3;    /* Serial ports          */
  228.         unsigned game : 1;        /* Game adapter installed?     */
  229.         unsigned modem : 1;     /* Internal modem?         */
  230.         unsigned printers : 2;    /* Number of printers         */
  231.     } bits;
  232.     } equip;
  233.     char **pt;
  234.     char *pt1;
  235.  
  236.  
  237.     FP_SEG(pt) = 0x10;
  238.     FP_OFF(pt) = 0xa0;
  239.     pt1 = *pt;
  240.     pt1 += 5;
  241.     pt = pt1 + 12;
  242.     p_aparm = *pt;
  243.     pt = pt1 + 16;
  244.     p_lparm = *pt;
  245.  
  246.     conv_id = p_lparm -> conv_id;
  247.     memcpy(lu_id,p_lparm -> lu_id,8);
  248.     memcpy(tp_id,p_lparm -> tp_id,8);
  249.     if (tp_id[0] != 0) {
  250.         tp_exist = 1;
  251.     }
  252.  
  253.     strcpy(path, "*.*");
  254.     pa[0] = pi;
  255.     pa[1] = po;
  256. /*
  257.     if (argc == 1) {
  258.         inv_off = 1;
  259.     }
  260.     if ((strcmp(argv[1], "/i") == 0)||(strcmp(argv[1], "/I") == 0)) {
  261.         inv_off = 0;
  262.     }
  263.     if ((strcmp(argv[1], "/o") == 0)||(strcmp(argv[1], "/O") == 0)) {
  264.         inv_off = 1;
  265.     }
  266. */
  267.     tlx[0] = &tpx1;
  268.     tlx[1] = &tpx2;
  269.     tlx[2] = &tpx3;
  270.     tlx[3] = &tpx4;
  271.     tlx[4] = &tpx5;
  272.  
  273.     ttp = dta;
  274.     tp1 = FP_OFF ( ttp );
  275.     tp2 = FP_SEG ( ttp );
  276.   /*
  277.     _asm
  278.         {
  279.           mov   ax, word ptr tp2[0]
  280.           push  ds
  281.           mov   ds, ax
  282.           mov   dx, word ptr tp1[0]
  283.           mov   ah, 1ah
  284.           int   21h
  285.           pop   ds
  286.         }
  287.    */
  288.     _asm
  289.         {
  290.           push  es
  291.           mov   ax, 0f000h
  292.           mov   es, ax
  293.           mov   al, es:[0fffeh]
  294.           mov   byte ptr j[0], al
  295.           pop   es
  296.     }
  297.     if ((j == 0xff)) {   /* IBM PC */
  298.         drivecnt = 2;
  299.         goto Set_vm;
  300.     }
  301.     if ((j == 0xfe)) {   /* IBM PC/XT */
  302.         drivecnt = 3;
  303.         goto Set_vm;
  304.     }
  305.     if ((j == 0xfb)) {   /* Robotron 1834 */
  306.         drivecnt = 3;
  307.         goto Set_vm;
  308.     }
  309.     equip.u = _bios_equiplist();
  310.     _asm
  311.        {
  312.         mov  ah, 08h
  313.         mov  dl, 05h
  314.         int  13h
  315.         mov  byte ptr j[0], dl
  316.        }
  317.     drivecnt = j;
  318.        if (j == 0) {
  319.             dr_opt[0] = NULL;
  320.             dr_opt[1] = NULL;
  321.        }
  322.        if (j == 1) {
  323.             dr_opt[1] = NULL;
  324.        }
  325.        _asm
  326.            {
  327.                mov  cx, 7
  328.                mov  dl, 80h
  329.         Look:
  330.            push cx
  331.            push dx
  332.                mov  ah, 08h
  333.                int  13h
  334.            pop  dx
  335.                jc   Eexit
  336.            inc  dl
  337.            pop  cx
  338.                loop Look
  339.            Eexit:
  340.                and  dl, 7fh
  341.                mov  byte ptr j[0], dl
  342.        }
  343.        drivecnt += j;
  344.        for (i = j + 2; i < 7; i++) {
  345.             dr_opt[i] = NULL;
  346.        }
  347.        j = 0;
  348.        for (i = 0; i < 7; i++) {
  349.             if (dr_opt[i] != NULL) {
  350.                 drive_ind[j] = i;
  351.                 j++;
  352.             }
  353.        }
  354. Set_vm:
  355.         init_adapter();
  356.         switch (vmode) {
  357.         case MONO:  vid_mem = (char far *) 0xb0000000;
  358.                 break;
  359.         case CGA:   vid_mem = (char far *) 0xb8000000;
  360.                 break;
  361.         case EGA:   vid_mem = (char far *) 0xb8000000;
  362.                 break;
  363.         }
  364.  
  365.  
  366.        sv = malloc(4000);
  367.        cls(1);
  368.        sfs(sv, vid_mem);
  369.        goto_xy(0,0);
  370.        for (i = 0; i < MAX_FRAME; i++) {
  371.            frame[i].p = NULL;
  372.        }
  373.  
  374.        /* Make frame 0 and 1 */
  375.  
  376.        frame[0].startx = 0;
  377.        frame[0].endx = 0;
  378.        frame[0].starty = 0;
  379.        frame[0].endy = 78;
  380.        frame[0].menu = (char **)topline;
  381.        frame[0].border = 0;
  382.        frame[0].keys = NULL;
  383.        frame[0].count = 4;
  384.        frame[0].attrib = 0x7f; /* 0x1f; */
  385.        frame[0].active = 0;
  386.        frame[0].p = malloc(80*2);
  387.        frame[0].shd = 0;
  388.  
  389.         frame[1].startx = 24;
  390.         frame[1].endx = 24;
  391.         frame[1].starty = 0;
  392.         frame[1].endy = 78;
  393.         frame[1].menu = (char **)btline;
  394.         frame[1].border = 0;
  395.         frame[1].keys = NULL;
  396.             frame[1].count = 5;
  397.         frame[1].attrib = 0x70; /* 0x50; */
  398.         frame[1].active = 0;
  399.         frame[1].p = malloc(80*2);
  400.         frame[1].shd = 0;
  401.  
  402.        frame[8].startx = 6;
  403.        frame[8].endx = 21;
  404.        frame[8].starty = 8;
  405.        frame[8].endy = 72;
  406.        frame[8].menu = (char **)btline;
  407.        frame[8].border = 0;
  408.        frame[8].keys = NULL;
  409.        frame[8].count = 4;
  410.        frame[8].attrib = 0x1e;
  411.        frame[8].active = 0;
  412.        frame[8].p = malloc((80*23)*2);
  413.        frame[8].shd = 1;
  414.  
  415.        attr1b = frame[8].attrib;
  416.  
  417.        make_menu(2, f_opt, "cdae", 4, 1, 0, BORDER, 0x1a,1);
  418.        make_menu(3, r_opt, "adsct", 5, 1, 8, BORDER, 0x1a,1);
  419.        make_menu(4, o_opt, "swr", 3, 1, 16, BORDER, 0x1a,1);
  420.        make_window(5,"Local LU",4,10,8,40,BORDER, 0x30, 1);
  421.        make_menu(6, dr_opt, "", drivecnt, 4, 6, BORDER, 0x1e, 1);
  422.        make_menu(7, prwin, "", 7, 7, 22, BORDER, 0x1e, 1);
  423.        make_window(10,"TTY information screen",0,0,5,79,BORDER, 0x30, 0);
  424.        make_window(11,"TTY emulating screen",6,0,24,79,BORDER, 0x71, 0);
  425.        make_window(14,"Errors",12,30,18,60,BORDER, 0x51, 1);
  426.        make_window(15,"OK",12,30,18,60,BORDER, 0x51, 1);
  427.        make_window(16,"LU Partner",8,30,13,60,BORDER, 0x71, 1);
  428.        make_window(17,"LU Partner",11,32,16,62,BORDER, 0x71, 1);
  429.        make_window(18,"LU Partner",14,34,19,64,BORDER, 0x71, 1);
  430.        make_window(19,"LU Partner",17,36,22,66,BORDER, 0x71, 1);
  431.        make_window(20,"Send",10,11,18,70,BORDER, 0x71, 1);
  432.        make_window(21,"Remote Control",8,21,18,60,BORDER, 0x70, 1);
  433.        make_window(22,"List of LU",4,10,18,70,BORDER, 0x70, 1);
  434.        make_window(23,"",19,10,21,70,BORDER, 0x70, 1);
  435.        make_window(25,"Help",0,0,24,79,BORDER, 0x27, 0);
  436.        make_window(26,"Receive File",10,10,18,59, BORDER, 0x17, 1);
  437.        make_window(27,"File Filter",15,20,19,50, BORDER, 0x70, 1);
  438.        make_window(28,"Copy Shell",5,10,20,70, BORDER, 0x27, 1);
  439.        make_window(29,"",4,6,19,70, 0, 0x27, 1);
  440.        make_window(30,"Enter arguments",19,10,21,70,BORDER, 0x70, 1);
  441.        /* 24 - reserved */
  442.  
  443.        fp_help = open("help.txt", O_RDONLY | O_TEXT);
  444.        if (fp_help != NULL) {
  445.             if (read(fp_help, &index, TPG * sizeof(struct index)) < 0) {
  446.                 close(fp_help);
  447.                 fp_help = 0;
  448.             }
  449.        }
  450.        pd_driver();
  451.        for (i = 0; i < MAX_FRAME; i++) {
  452.            if (frame[i].p != NULL) {
  453.                free(frame[i].p);
  454.            }
  455.        }
  456.        free(sv);
  457.        save_ini();
  458.        close(fp_help);
  459.        cls(0);
  460.        p_aparm -> status = 0;
  461.        p_aparm -> rc = 0;
  462.        exit (0);
  463. }
  464.  pd_driver()
  465.         {
  466.             int choice1, choice2, selection;
  467.             unsigned int ch;
  468.             int i, cnt;
  469.  
  470.             /* Put on screen menu 0 */
  471.  
  472.             cnt = 1;
  473.             save_video(0);
  474.             save_video(1);
  475.    Retry:
  476.             write_string(0, 0, topline[0], frame[0].attrib);
  477.             write_string(0, 8, topline[1], frame[0].attrib);
  478.             write_string(0, 16, topline[2], frame[0].attrib);
  479.             write_string(0, 74, topline[3], frame[0].attrib);
  480.  
  481.             write_string(24, 0, btline[0], frame[1].attrib);
  482. /*          write_string(24, 10, btline[1], frame[1].attrib);
  483.             write_string(24, 20, btline[2], frame[1].attrib);  */
  484.             write_string(24, 10, btline[4], frame[1].attrib);
  485.  
  486.         sfs(sv, vid_mem);
  487.             if( p_aparm -> rc != 0){ /* recall aplmain */
  488.                 cnt = 0;
  489.                 if( p_aparm -> rc == 2)
  490.                     write_string(0, 0, topline[0], REV_VID);
  491.                 else
  492.                     write_string(0, 16, topline[2], REV_VID);
  493.                 goto ReCall;
  494.             }
  495.         if (cnt == 1) {
  496.                 save_video(7);
  497.                 draw_border(7);
  498.                 display_menu(7);
  499.                 frame[7].active = 1;
  500.             }
  501.             if ((ch = getch()) == ESC) {
  502.                 return 0;
  503.             }
  504.             restore_video(7);
  505.             if (ch == 0) {
  506.                 switch (ch = getch()) {
  507.                     case F1 :
  508.                               help("0   ");
  509.                               break;
  510.                     case F3 :
  511.                               break;
  512.                     case F10 :
  513.                               if (cnt == 1) {
  514.                                 cnt = 0;
  515.                               }
  516.                               write_string(0, 0, topline[0], REV_VID);
  517.                               ReCall:
  518.                               set_ini();
  519.                               i = pr_m0();
  520.                               restore_video(0);
  521.                               if (i == -1) {
  522.                                 return 0;
  523.                               }
  524.                               break;
  525.                  }
  526.             }
  527.             goto Retry;
  528. }
  529.  pr_m0()
  530. {
  531.         int choice1, choice2, choice3, selection;
  532.         int ind, swi;
  533.         unsigned int ch;
  534.         unsigned long rc;
  535.         char far *sv1;
  536.         char c_buf[80];
  537.         char c_pt[30];
  538.  
  539.          choice1 = 0;
  540.          if( p_aparm -> rc == 2) /* DOS shell */
  541.                 goto Ag;
  542.          if(( p_aparm -> rc == 1) || ( p_aparm -> rc == 3)){ /* transaction  or command */
  543.                 Fmh5Handler();
  544.          }
  545.  
  546.  
  547.          for (;;) {
  548.              if ((ch = getch()) == ESC) {
  549.                 return -1;
  550.              }
  551.          if (ch == '\r') {
  552.          Ag:
  553.        sfs(sv, vid_mem);
  554.        while ((selection = pulldown(choice1 + 2)) != -1) {
  555.             if ((selection == -2)||(selection == -3)) {
  556.         restore_video(choice1 + 2);
  557.                 choice2 = choice1;
  558.         if ((selection == -2))
  559.             if (choice1 == 0)
  560.             choice1 = 2;
  561.             else
  562.             choice1--;
  563.         else
  564.             if (choice1 == 2)
  565.             choice1 = 0;
  566.             else
  567.             choice1++;
  568.                 switch (choice2) {
  569.             case 0 :
  570.                   write_string(0, 0, topline[0], frame[0].attrib);
  571.                               break;
  572.                     case 1 :
  573.                   write_string(0, 8, topline[1], frame[0].attrib);
  574.                   break;
  575.             case 2 :
  576.                   write_string(0, 16, topline[2], frame[0].attrib);
  577.                   break;
  578.                 }
  579.                 switch (choice1) {
  580.             case 0 :
  581.                   write_string(0, 0, topline[0], REV_VID);
  582.                   break;
  583.             case 1 :
  584.                   write_string(0, 8, topline[1], REV_VID);
  585.                   break;
  586.             case 2 :
  587.                   write_string(0, 16, topline[2], REV_VID);
  588.                   break;
  589.                 }
  590.                 sfs(sv, vid_mem);
  591.                 continue;
  592.             }
  593.             switch (choice1) {
  594.                 case 0 : /* File menu */
  595.                          switch (selection) {
  596.                             case 0 : /* Change dir. */
  597.                                      if ((choice2 = pulldown(6)) != -1) {
  598.                                           ch_drive(drive_ind[choice2]);
  599.                      }
  600.                      restore_video(6);
  601.                                      break;
  602.                             case 1 : /* Dos shell */
  603.                                      cls(0);
  604.                                      save_ini();
  605.                                      p_lparm -> conv_id = conv_id;
  606.                                      memcpy( p_lparm -> lu_id, lu_id,8);
  607.                                      memcpy( p_lparm -> tp_id, tp_id,8);
  608.                                      p_aparm -> status = 2;
  609.                                      p_aparm -> rc = 2;
  610.                                      exit(2);
  611.                             case 2 : /* About */
  612.                                      help("0   ");
  613.                                      break;
  614.                             case 3 : /* Exit */
  615.                                      return -1;
  616.                           }
  617.                           break;
  618.                 case 1 : /* Run menu */
  619.                          switch (selection) {
  620.                             case 0 : /* Attach local LU */
  621.                                      SetLu();
  622.                                      break;
  623.                             case 1 : /* Detach local LU */
  624.                                      detach_lu (lu_id, &rc);
  625.                                      memset(lu_id, 0, 8);
  626.                                      break;
  627.                             case 2 : /* Select active partner */
  628.                                      SelPtLu();
  629.                                      break;
  630.                             case 3 : /* Select file and send */
  631.                                      CpFl(choice1 + 2);
  632.                                      break;
  633.                             case 4 : /* TTY */
  634.                                      em_tty();
  635.                           }
  636.                           break;
  637.                 case 2 : /* Options menu */
  638.                          switch (selection) {
  639.                             case 0 : /* Change LU options */
  640.                                      break;
  641.                             case 1 : /* Show partners */
  642.                                      showp(1); /* show and pause */
  643.                                      break;
  644.                 case 2 : /* Remote control */
  645.                                      Fmh5Handler();
  646.                      break;
  647.                           }
  648.                           break;
  649.              }
  650.            }
  651.             restore_video(choice1 + 2);
  652.          }
  653.                  choice2 = choice1;
  654.          if (ch == 0) {
  655.                     switch (ch = getch()) {
  656.                          case LT :
  657.                    if (choice1 == 0) {
  658.                     choice1 = 2;
  659.                     break;
  660.                    }
  661.                    choice1--;
  662.                    break;
  663.              case RT :
  664.                    if (choice1 == 2) {
  665.                     choice1 = 0;
  666.                     break;
  667.                    }
  668.                    choice1++;
  669.                    break;
  670.                          case F1 :
  671.                                    switch (choice1) {
  672.                                         case  0:  help("2   ");
  673.                                                   break;
  674.                                         case  1:  help("3   ");
  675.                                                   break;
  676.                                         case  2:  help("4   ");
  677.                                                   break;
  678.                                     }
  679.                                    break;
  680.                     }
  681.          switch (choice2) {
  682.             case 0 :
  683.                   write_string(0, 0, topline[0], frame[0].attrib);
  684.                               break;
  685.                     case 1 :
  686.                   write_string(0, 8, topline[1], frame[0].attrib);
  687.                   break;
  688.             case 2 :
  689.                   write_string(0, 16, topline[2], frame[0].attrib);
  690.                   break;
  691.           }
  692.          switch (choice1) {
  693.             case 0 :
  694.                   write_string(0, 0, topline[0], REV_VID);
  695.                   break;
  696.             case 1 :
  697.                   write_string(0, 8, topline[1], REV_VID);
  698.                   break;
  699.             case 2 :
  700.                   write_string(0, 16, topline[2], REV_VID);
  701.                   break;
  702.           }
  703.          }
  704.     }
  705.     return 0;
  706. }
  707. CpFl(nw)
  708. int nw;
  709. {
  710.       char *s_dir;
  711.       char msg[20];
  712.       char *p_nm[4];
  713.       char dr_ind[40];
  714.       register unsigned    i;
  715.       unsigned char attr1;
  716.       unsigned char attr2;
  717.       unsigned char attr;
  718.       unsigned ch;
  719.       int k;
  720.       char *tmp;
  721.       int to;
  722.       int from;
  723.  
  724.       restore_video(nw);
  725.       if ((s_dir = malloc(_MAX_PATH)) == NULL) {
  726.       return -1;
  727.       }
  728.       window(28);
  729.       strcpy(msg, "Source LU ----> ");
  730.       write_string(7, 14, msg, 0x2f);
  731.       strcpy(ps[0], "1. ");
  732.       strcat(ps[0], lu_name);
  733.       p_nm[0] = ps[0];
  734.       for (i = 1; i < p_lu_num+ 1; i++) {
  735.           ps[i][0] = (i + 1) | 0x30;
  736.           ps[i][1] = 0x00;
  737.           strcat(ps[i], ". ");
  738.       strcat(ps[i], pstr[i-1].plu);
  739.       p_nm[i] = ps[i];
  740.       }
  741.       make_menu(24, p_nm, "12345", p_lu_num + 1, 7, 30, BORDER, 0x72, 1);
  742.       sfs(sv, vid_mem);
  743.       i = pulldown(24);
  744.       from = i;
  745.       strcpy(msg, "Copy From ");
  746.       strcat(msg, &ps[i][3]);
  747.       write_string(18, 14, msg, 0x2f);
  748.  
  749.       strcpy(msg, "Target LU ----> ");
  750.       write_string(7, 14, msg, 0x2f);
  751.       sfs(sv, vid_mem);
  752.       i = pulldown(24);
  753.       to = i;
  754.       strcpy(msg, " To  ");
  755.       strcat(msg, &ps[i][3]);
  756.       write_string(18, 32, msg, 0x2f);
  757.     _asm
  758.        {
  759.         mov ah, 0
  760.         int 1ah
  761.     add dx, 9 // 1/2 sec.
  762.         mov bx, dx
  763.     repeat:
  764.         int 1ah
  765.         cmp dx, bx
  766.         jne repeat
  767.        }
  768.  
  769.       restore_video( 24 );
  770.       deactivate(28);
  771.       attr1 = frame[29].attrib;
  772.       attr2 = frame[8].attrib;
  773.       _getdcwd(0, s_dir, _MAX_PATH);
  774.       if (to == 0) {
  775.      strcpy(pa[1], s_dir);
  776.       }
  777.       else {
  778.         if (rem_path(po, to-1) < 0) {
  779.            window(14);
  780.            window_xy(14, 1, 4);
  781.            window_puts(14, "Get path failure");
  782.            window_xy(14, 2, 3);
  783.            window_puts(14, "Press ESC to exit");
  784.            while ((ch = getch()) != ESC) ;
  785.            deactivate(14);
  786.            return 0;
  787.         }
  788.       }
  789.  
  790.       if (from == 0) {
  791.          strcpy(pi, s_dir);
  792.          cur_ln = to - 1;
  793.       }
  794.       else {
  795.         if (rem_path(pi, from-1) < 0) {
  796.            window(14);
  797.            window_xy(14, 1, 4);
  798.            window_puts(14, "Get path failure");
  799.            window_xy(14, 2, 3);
  800.            window_puts(14, "Press ESC to exit");
  801.            while ((ch = getch()) != ESC) ;
  802.            deactivate(14);
  803.            return 0;
  804.         }
  805.       }
  806.    ReCopy:
  807.       window(29);
  808.       write_string(5, 11, "        ", attr1b);
  809.       strcpy(dr_ind, "Target : ");
  810.       if (to == 0) {
  811.          strcat(dr_ind, lu_name);
  812.       }
  813.       else
  814.      strcat(dr_ind, pstr[to-1].plu);
  815.  
  816.       write_string(5, 11, dr_ind, frame[29].attrib | 0x0f);
  817.       strcpy(dr_ind, p_dcl);
  818.       strcat(dr_ind, pa[1]);
  819.       write_string(5, 26, "                                        ", frame[29].attrib);
  820.       attr = frame[29].attrib;
  821.       if (attr == 0x1e) {
  822.          attr &= 0xf0;
  823.      attr |= 0x0c;
  824.       }
  825.       else
  826.          attr &= 0xf0;
  827.  
  828.       write_string(5, 26, dr_ind, attr);
  829.       sfs(sv, vid_mem);
  830.       save_video(8);
  831.       frame[8].active = 1;
  832.       i = 0;
  833.       if ((k = menu0(vid_mem, to, from)) == 2) {
  834.           i = from;
  835.           from = to;
  836.       to = i;
  837.           tmp = pa[0];
  838.           pa[0] = pa[1];
  839.           pa[1] = tmp;
  840.           if ((from == to)) {
  841.               if (from == 0) {
  842.                  chdir(pa[0]);
  843.               }
  844.               else
  845.                  rem_cd(pa[0], from);
  846.           }
  847.       i = frame[29].attrib;
  848.       frame[29].attrib = frame[8].attrib;
  849.       frame[8].attrib = i;
  850.           i = -1;
  851.       }
  852.       else
  853.             if ( k == 3 ) {
  854.                i = -1;
  855.             }
  856.       restore_video(8);
  857.       deactivate(29);
  858.       if (i == -1) {
  859.           goto ReCopy;
  860.       }
  861.       chdir(s_dir);
  862.       frame[29].attrib = attr1;
  863.       frame[8].attrib = attr2;
  864.       free(s_dir);
  865.       return 0;
  866. }
  867.